//package com.yunhe.option.controller.base;
//
//
//import com.yunhe.common.exception.ArgumentErrorException;
//import com.yunhe.common.exception.ObjectNotFoundException;
//import com.yunhe.common.exception.UniqueConstraintsException;
//import com.yunhe.common.model.ResultObject;
//import com.yunhe.option.domain.base.ProtectionEquipmentStatus;
//import com.yunhe.option.service.base.ProtectionEquipmentStatusService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.Optional;
//
///**
// * 环保设备运行情况Controller
// * @author anmeiyi
// */
//@Api(value = "ProtectionEquipmentStatus", description = "环保设备运行情况", tags = {"Base_ProtectionEquipmentStatus"})
//@RestController
//@RequestMapping("/protectionEquipmentStatus")
//public class ProtectionEquipmentStatusController {
//    @Autowired
//    private ProtectionEquipmentStatusService protectionEquipmentStatusService;
//
//    /**
//     * 新增环保设备运行情况
//     * @param protectionEquipmentStatus 环保设备运行情况对象
//     */
//    @ApiOperation("新增环保设备运行情况")
//    @RequestMapping(method = RequestMethod.POST)
//    public ResponseEntity<ResultObject> post(
//            @RequestBody ProtectionEquipmentStatus protectionEquipmentStatus)
//            throws ArgumentErrorException, UniqueConstraintsException {
//        ProtectionEquipmentStatus newProtectionEquipmentStatus = protectionEquipmentStatusService.createProtectionEquipmentStatus(protectionEquipmentStatus);
//        return new ResponseEntity<>(new ResultObject<>(newProtectionEquipmentStatus), HttpStatus.OK);
//    }
//
//    /**
//     * 根据ID删除环保设备运行情况
//     * @param id 环保设备运行情况ID
//     */
//    @ApiOperation("根据ID删除环保设备运行情况")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "环保设备运行情况ID", required = true, dataType = "long", paramType = "path")
//    })
//    @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
//    public ResponseEntity<ResultObject> delete(
//            @PathVariable("id") Long id) {
//        protectionEquipmentStatusService.deleteProtectionEquipmentStatus(id);
//        return new ResponseEntity<>(new ResultObject<>(null), HttpStatus.OK);
//    }
//
//    /**
//     * 更新环保设备运行情况
//     * @param id
//     * @param protectionEquipmentStatus
//     */
//    @ApiOperation("更新环保设备运行情况")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "环保设备运行情况ID", required = true, dataType = "long", paramType = "path")
//    })
//    @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
//    public ResponseEntity<ResultObject> put(
//            @PathVariable("id") Long id,
//            @RequestBody ProtectionEquipmentStatus protectionEquipmentStatus)
//            throws ArgumentErrorException, ObjectNotFoundException, UniqueConstraintsException {
//        protectionEquipmentStatus.setId(id);
//        ProtectionEquipmentStatus newProtectionEquipmentStatus = protectionEquipmentStatusService.updateProtectionEquipmentStatus(protectionEquipmentStatus);
//        return new ResponseEntity<>(new ResultObject(newProtectionEquipmentStatus), HttpStatus.OK);
//    }
//
//    /**
//     * 更新环保设备运行情况（指定字段）
//     * @param id
//     * @param code
//     * @param name
//     * @param title
//     * @param sn
//     * @param activity
//     */
//    @ApiOperation("更新环保设备运行情况")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "id", value = "环保设备运行情况ID", required = true, dataType = "long", paramType = "path"),
//            @ApiImplicitParam(name = "code", value = "环保设备运行情况代码", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "name", value = "环保设备运行情况编号", dataType = "string", paramType = "query"),
//            @ApiImplicitParam(name = "title", value = "环保设备运行情况名称", dataType = "string", paramType = "query"),
//            @ApiImplicitParam(name = "sn", value = "排序序号", dataType = "long", paramType = "query"),
//            @ApiImplicitParam(name = "activity", value = "是否可用", dataType = "boolean", paramType = "query")
//    })
//    @RequestMapping(value = "/{id}", method = RequestMethod.PATCH)
//    public ResponseEntity<ResultObject> patch(
//            @PathVariable("id") Long id,
//            @RequestParam("code") Optional<Long> code,
//            @RequestParam("name") Optional<String> name,
//            @RequestParam("title") Optional<String> title,
//            @RequestParam("sn") Optional<Long> sn,
//            @RequestParam("activity") Optional<Boolean> activity)
//            throws ArgumentErrorException, ObjectNotFoundException, UniqueConstraintsException{
//        ProtectionEquipmentStatus newProtectionEquipmentStatus = protectionEquipmentStatusService.updateProtectionEquipmentStatus(id, code.orElse(null), name.orElse(null), title.orElse(null), sn.orElse(null), activity.orElse(null));
//        return new ResponseEntity<>(new ResultObject(newProtectionEquipmentStatus), HttpStatus.OK);
//    }
//
//    /**
//     * 获得环保设备运行情况列表
//     */
//    @ApiOperation("获得环保设备运行情况列表")
//    @RequestMapping(method = RequestMethod.GET)
//    public ResponseEntity<ResultObject> search() {
//        Iterable<ProtectionEquipmentStatus> industryCategories = protectionEquipmentStatusService.findIndustryCategories();
//        return new ResponseEntity<>(new ResultObject(industryCategories), HttpStatus.OK);
//    }
//}
